<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body onload="init()">

	  #set(aa="sdfsdf,sdfdsf,sdfdsf")
	  #set(ar=aa.split(","))
	  #(ar)
  	<p><input type="text" id="msg"><input type="button" onclick="subsend()" value="发送"></p>
  	<p id="content"></p>
    <script type="text/javascript">
		var ws;
		function init(){
		    ws = new WebSocket("ws://localhost:8080/crowdsourcing/websocket");
		    ws.onopen = function(evn){
		        console.log(evn);
		    };
		    ws.onmessage = function(evn){
		         var dv = document.getElementById("content");
		         dv.innerHTML+=evn.data+"<br>";
		    };
		    ws.onclose = function(){
		        console.log("关闭");
		    };
		};
		function subsend(){
		    var msg = document.getElementById("msg").value;
		    ws.send(msg);
		}
	</script>
  </body>
</html>
